﻿@model FlashCards.WebApp.Models.AddFriendToGroupModel

@{
    ViewBag.Title = "AddFriendToGroup";
}

<h2>Your friends</h2>

<table>
    <tr>
        <th>Name</th>
        <th>Surname</th>
        <th>User name</th>
        <th></th>
    </tr>

@foreach (var friendModel in Model.Friends) {
    <tr>
        <td>
            @Html.DisplayFor(x => friendModel.Friend.Name)
        </td>
        <td>
            @Html.DisplayFor(x => friendModel.Friend.Surname)
        </td>
        <td>
            @Html.DisplayFor(x => friendModel.Friend.UserName)
        </td>
        <td>
        @if (!friendModel.IsAlreadyInGroup)
        {
            using (Html.BeginForm(new { groupId = Model.Group.GroupId, friendId = friendModel.Friend.UserId }))
            {
                <input type="submit" value="Add to group" />
            }
        }
        else
        {
            <p>already in group</p>
        }
        </td>
    </tr>
}

</table>
